﻿'========================================================================
'功能:申請種類商業邏輯物件
'作者:andy
'日期: 2011/3/1
'========================================================================

Imports Microsoft.VisualBasic
Imports System
Imports System.Collections.Generic
Imports System.Data.SqlClient
Imports System.Text
Imports System.Data
Namespace Telecom.BBL
    Public Class TelTypeBBL


        ''' <summary>
        ''' 取得某一廠的申請類別
        ''' </summary>
        ''' <param name="suit_site"></param>
        ''' <param name="Kind"></param>
        ''' <returns>取得某一廠的申請類別</returns>
        ''' <remarks>取得某一廠的申請類別</remarks>

        Public Function GetTelType(ByVal suit_site As String, ByVal Kind As String, ByVal dbName As String) As DataTable
            Dim db1 As Telecom.DAO.TelTypeDAO = New Telecom.DAO.TelTypeDAO(dbName)
            If Kind = "" Then
                Return db1.GetTelType(suit_site)
            Else
                Return db1.GetTelTypeInsert(suit_site)
            End If

        End Function
        Public Sub UpdateTelType(ByVal dbName As String, ByVal canModi As Boolean, ByVal type_code As String, ByVal type_name As String, ByVal suit_site As String, ByVal type_desc As String, ByVal NeedApprove As Integer, ByVal UID As String, ByVal NeedExt As Boolean, ByVal OnsiteFill As Boolean, ByVal FamilyCode As Boolean, ByVal Message As String)
            Dim db1 As Telecom.DAO.TelTypeDAO = New Telecom.DAO.TelTypeDAO(dbName)
            If canModi Then
                db1.InsertTelType(type_code, type_name, suit_site, type_desc, NeedApprove, NeedExt, UID, OnsiteFill, FamilyCode, Message)
            Else
                db1.UpdateTelType(type_code, type_name, suit_site, type_desc, NeedApprove, NeedExt, UID, OnsiteFill, FamilyCode, Message)
            End If
        End Sub

        ''' <summary>
        ''' 檢查申請類別是否存在
        ''' </summary>
        ''' <param name="suit_site"></param>
        ''' <param name="type_code"></param>
        ''' <returns>檢查申請類別是否存在</returns>
        ''' <remarks>檢查申請類別是否存在</remarks>
        Public Function type_codeIsExist(ByVal dbName As String, ByVal suit_site As String, ByVal type_code As String) As Boolean
            Dim db1 As Telecom.DAO.TelTypeDAO = New Telecom.DAO.TelTypeDAO(dbName)
            Return db1.type_codeIsExist(suit_site, type_code)
        End Function



        ''' <summary>
        ''' 取得某一筆的申請項目資料
        ''' </summary>
        ''' <param name="suit_site">廠別</param>
        ''' <param name="type_code">申請項目代號</param>
        ''' <returns>取得某一筆的申請項目資料</returns>
        ''' <remarks>取得某一筆的申請項目資料</remarks>
        Public Function GetTypeCode(ByVal suit_site As String, ByVal type_code As String, ByVal dbName As String) As DataTable
            Dim db1 As Telecom.DAO.TelTypeDAO = New Telecom.DAO.TelTypeDAO(dbName)
            Return db1.GetTypeCode(suit_site, type_code)

        End Function
    End Class
End Namespace

